package com.szholly.pro.watergas_server.ps.android.controller;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import com.szholly.pro.watergas_server.common.data.DataUtil;
import com.szholly.data.general.GlobalParameter;
import com.szholly.data.general.RowBase;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

/**
 * 排水管网分页
 */
public class PipelinesPagingManager {
	// 获取排水管网分页数据
	public String getPipelinesPagingData(String type, String params) {
		JSONObject errorJson = new JSONObject();
		errorJson.put("error", "类型有误");
		errorJson.put("paramInfo", "{}");
		errorJson.put("pageInfo", "{}");
		errorJson.put("data", "[]");
		if (type == null || type.isEmpty()) {
			return errorJson.toString();
		}

		// 解析参数
		PipelinesPagingRequest request = PipelinesPagingRequest.getPipelinesPagingRequest(params);
		String result = errorJson.toString();
		if ("排水管网".equals(type)) {
			result = getPipelinesData(request);
		} else if ("污水厂".equals(type)) {
			result = getSewageData(request);
		} else if ("管网监测点".equals(type)) {
			result = getPipePoint(request);
		} else if ("规划管网".equals(type)) {
			result = getPipePlanData(request);
		} else if ("清源小区".equals(type)) {
			result = getCommunityData(request);
		} else if ("排水管网设施".equals(type)) {
			result = getPlumbingData(request);
		} else if ("内窥检测".equals(type)) {
			result = getEndoscopicDefectData(request);
		}
		return result;
	}

	// 排水管网
	public String getPipelinesData(PipelinesPagingRequest request) {
		// 返回的结果
		JSONObject resultJson = new JSONObject();
		// 数据
		JSONArray dataArray = new JSONArray();
		JSONObject paramInfo = new JSONObject();
		JSONObject extraInfo = new JSONObject();
		
		// 报错信息
		String error = "";

		// 开始查询
		List<GlobalParameter> parms = new ArrayList<GlobalParameter>();
		String sql = "SELECT t.*,ROWNUM as ROW_NO FROM SDE.PS_PIPE t WHERE 1 = 1";
		
		String lengthSql ="SELECT * FROM sde.ps_pipe WHERE 1 = 1"; 
		try {
			String filter = null;

			// 管网类型
			filter = request.getPipelinesType();
			if (filter != null && !filter.isEmpty()) {
				sql += " and 排水 = '" + filter + "'";
				lengthSql += " and 排水 = '" + filter + "'";
			}

			// 行政区划
			filter = request.getUnit();
			if (filter != null && !filter.isEmpty()) {
				sql += " and 行政区划 like '%" + filter + "%'";
				lengthSql +=" and 行政区划 like '" + filter + "%'";
			}

			// 街道
			filter = request.getStreet();
			if (filter != null && !filter.isEmpty()) {
				sql += " and 行政区划 like '%" + filter + "%'";
			}

			// 搜索
			filter = request.getSearchText();
			if (filter != null && !filter.isEmpty()) {
				sql += " and ("

						+ "PRJ_NAME like '%" + filter + "%'"

						+ " or 本点号 like '%" + filter + "%'"

						+ ")";
			}
		} catch (Exception e) {
		}

		int count = 0;
		// 统计总数
		try {
			count = getTotalCount(sql);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		request.setCount(count);
		
		//查找总长度
		String totalLength = "0.0";
		lengthSql = "SELECT SUM(t.shape.len) TOTAL_LENGTH from ("+lengthSql+")t WHERE 1 = 1";
		try {
			List<RowBase> rows = DataUtil.getSelectRows(lengthSql, parms);
			double length = rows.get(0).getSafeDouble("TOTAL_LENGTH");			
			BigDecimal b = new BigDecimal(length);  
			totalLength = String.valueOf(b.setScale(2,BigDecimal.ROUND_HALF_UP).toPlainString());  
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		
		
		// 开始查询
		// 增加分页条件--起始页和终点页
		int startNum = (request.getPageIndex() - 1) * request.getPageSize();
		int endNum = request.getPageIndex() * request.getPageSize();
		sql += " and ROWNUM <= " + endNum;

		String searchSql = " SELECT  t.行政区划 || t.街道名称 address,"
				+ " '材料：' || t.管线材料  || ' 管径：' || t.管径或断面 || ' 类型：' || t.排水 tip,t.shape.minx x,"
				+ "t.shape.miny y,t.OBJECTID, t.街道名称 || ' ' || t.本点号 name,t.本点号,t.管线材料,"
				+ "t.管径或断面,t.S_POINT,t.E_POINT,t.路名,t.街道名称,sde.st_astext(t.shape) wkt,"
				+ "t.行政区划,t.排水 管网类型,t.CONSTER_DEPT 建设单位 ,t.PIPELENGTH FROM (" + sql + ")t where 1 = 1";
		searchSql += " and t.ROW_NO > " + startNum;
		// 查询
		try {
			List<RowBase> searchResultRows = DataUtil.getSelectRows(searchSql, parms);
			dataArray = JSONArray.fromObject(searchResultRows);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		// 计算分页
		request.calculatePaging();
		JSONObject json = toJson(request);
		extraInfo.put("totalLength", totalLength);	
		resultJson.put("extra", extraInfo);
		resultJson.put("error", error);
		resultJson.put("paramInfo", paramInfo);
		resultJson.put("pageInfo", json);
		resultJson.put("data", dataArray);
		return resultJson.toString();
	}

	// 管网规划
	public String getPipePlanData(PipelinesPagingRequest request) {
		// 返回的结果
		JSONObject resultJson = new JSONObject();
		// 数据
		JSONArray dataArray = new JSONArray();
		JSONObject paramInfo = new JSONObject();
		// 报错信息
		String error = "";

		// 开始查询
		List<GlobalParameter> parms = new ArrayList<GlobalParameter>();
		String sql = "SELECT t.*,ROWNUM as ROW_NO FROM SDE.GHGW t WHERE 1 = 1";

		try {
			String filter = null;

			// 管网类型
			// filter = request.getPipelinesType();
			// if (filter != null && !filter.isEmpty()) {
			// sql += " and 排水 = '" + filter + "'";
			// }

			// 行政区划
			filter = request.getUnit();
			if (filter != null && !filter.isEmpty()) {
				sql += " and t.ALLNAME like '%" + filter + "%'";
			}

			// 街道
			filter = request.getStreet();
			if (filter != null && !filter.isEmpty()) {
				sql += " and t.ALLNAME like '%" + filter + "%'";
			}

			// 搜索
			filter = request.getSearchText();
			if (filter != null && !filter.isEmpty()) {
				sql += " and ("

						+ "t.ALLNAME like '%" + filter + "%'"

						+ " or t.OBJECTID like '%" + filter + "%'"

						+ ")";
			}
		} catch (Exception e) {
		}

		int count = 0;
		// 统计总数
		try {
			count = getTotalCount(sql);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		request.setCount(count);

		// 开始查询
		// 增加分页条件--起始页和终点页
		int startNum = (request.getPageIndex() - 1) * request.getPageSize();
		int endNum = request.getPageIndex() * request.getPageSize();
		sql += " and ROWNUM <= " + endNum;

		String searchSql = "select t.ALLNAME address,t.shape.minx x,t.shape.miny y,sde.st_astext(t.shape) wkt"
				+ ",t.objectid, t.jdname || ' ' || t.objectid name" + " from (" + sql + ")t where 1 = 1";
		searchSql += " and t.ROW_NO > " + startNum;
		// 查询
		try {
			List<RowBase> searchResultRows = DataUtil.getSelectRows(searchSql, parms);
			dataArray = JSONArray.fromObject(searchResultRows);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		// 计算分页
		request.calculatePaging();
		JSONObject json = toJson(request);
		resultJson.put("error", error);
		resultJson.put("paramInfo", paramInfo);
		resultJson.put("pageInfo", json);
		resultJson.put("data", dataArray);
		return resultJson.toString();
	}

	// 管网设施
	public String getPlumbingData(PipelinesPagingRequest request) {
		// 返回的结果
		JSONObject resultJson = new JSONObject();
		// 数据
		JSONArray dataArray = new JSONArray();
		JSONObject paramInfo = new JSONObject();
		// 报错信息
		String error = "";

		// 开始查询
		List<GlobalParameter> parms = new ArrayList<GlobalParameter>();
		String sql = "SELECT t.*,ROWNUM as ROW_NO FROM SDE.PS_POINT t WHERE 1 = 1 ";

		try {

			String filter = null;

			// 管网类型
			filter = request.getPipelinesType();
			if (filter != null && !filter.isEmpty()) {
				sql += " and t.POINT_TYPE = '" + filter + "'";
			}

			// 行政区划
			filter = request.getUnit();
			if (filter != null && !filter.isEmpty()) {
				sql += " and t.行政区划 like '%" + filter + "%'";
			}

			// 街道
			filter = request.getStreet();
			if (filter != null && !filter.isEmpty()) {
				sql += " and t.ALLNAME like '%" + filter + "%'";
			}

			// 搜索
			filter = request.getSearchText();
			if (filter != null && !filter.isEmpty()) {
				sql += " and ("

						+ "t.OBJECTID like '%" + filter + "%'"

						+ " or t.特征 like '%" + filter + "%'"

						+ " or t.PRJ_NAME like '%" + filter + "%'"

						+ ")";
			}
		} catch (Exception e) {
		}

		int count = 0;
		// 统计总数
		try {
			count = getTotalCount(sql);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		request.setCount(count);

		// 开始查询
		// 增加分页条件--起始页和终点页
		int startNum = (request.getPageIndex() - 1) * request.getPageSize();
		int endNum = request.getPageIndex() * request.getPageSize();
		sql += " and ROWNUM <= " + endNum;

		String searchSql = "select t.行政区划 || t.路名 || t.本点号 name,t.路名 address,'类型：'||t.POINT_TYPE || ' 附属物：' ||t.附属物 || ' 路名：'|| t.路名 tip"
				+ ",t.shape.minx x,t.shape.miny y,t.OBJECTID,t.本点号,t.路名,sde.st_astext(t.shape) wkt, t.街道名称,t.行政区划,t.排水 管网类型"
				+ " from (" + sql + ")t where 1 = 1";
		searchSql += " and t.ROW_NO > " + startNum;
		// 查询
		try {
			List<RowBase> searchResultRows = DataUtil.getSelectRows(searchSql, parms);
			dataArray = JSONArray.fromObject(searchResultRows);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		// 计算分页
		request.calculatePaging();
		JSONObject json = toJson(request);
		resultJson.put("error", error);
		resultJson.put("paramInfo", paramInfo);
		resultJson.put("pageInfo", json);
		resultJson.put("data", dataArray);
		return resultJson.toString();
	}

	// 内窥缺陷
	public String getEndoscopicDefectData(PipelinesPagingRequest request) {
		// 返回的结果
		JSONObject resultJson = new JSONObject();
		// 数据
		JSONArray dataArray = new JSONArray();
		JSONObject paramInfo = new JSONObject();
		// 报错信息
		String error = "";

		// 开始查询
		List<GlobalParameter> parms = new ArrayList<GlobalParameter>();
		String sql = "select t.objectid,t.LNO,t.ENAME,t1.DEFECT_LEVEL,t.SHAPE,t1.FLOW,t4.PROJECT_DEPT"
				+ ",t5.S_DOMAINCAPTION,t1.PIPE_DIAMETER,ROWNUM AS ROW_NO" + " from sde.JCGW t"
				+ " LEFT JOIN nkjc_defect t1 ON t.lno = t1.lno" + " left join PIPE_SECTION t2 on t1.pipe_no=t2.pipe_no"
				+ " left join project_item t3 on t2.project_item_no=t3.item_no"
				+ " left join PROJECT t4 on t3.project_no=t4.project_no"
				+ " left join(select s_id,S_DOMAINCAPTION from DATA_DEFULATDOMAIN where S_DOMAINNAME = '政区' and length(s_id)='2') t5 on t5.s_id =t3.DISTRICT"
				+ " WHERE 1 = 1";

		try {

			String filter = null;

			// 管网类型
			filter = request.getPipelinesType();
			if (filter != null && !filter.isEmpty()) {
				sql += " and t1.DEFECT_LEVEL = '" + filter + "'";
			}

			// 行政区划
			filter = request.getUnit();
			if (filter != null && !filter.isEmpty()) {
				sql += " and t5.S_DOMAINCAPTION like '%" + filter + "%'";
			}

			// 街道
			filter = request.getStreet();
			if (filter != null && !filter.isEmpty()) {
				sql += " and t5.S_DOMAINCAPTION like '%" + filter + "%'";
			}

			// 搜索
			filter = request.getSearchText();
			if (filter != null && !filter.isEmpty()) {
				sql += " and ("

						+ "t.OBJECTID like '%" + filter + "%'"

						+ " or t.ENAME like '%" + filter + "%'"

						+ " or t.LNO like '%" + filter + "%'"

						+ ")";
			}
		} catch (Exception e) {
		}

		int count = 0;
		// 统计总数
		try {
			count = getTotalCount(sql);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		request.setCount(count);

		// 开始查询
		// 增加分页条件--起始页和终点页
		int startNum = (request.getPageIndex() - 1) * request.getPageSize();
		int endNum = request.getPageIndex() * request.getPageSize();
		sql += " and ROWNUM <= " + endNum;

		String searchSql = "select t.lno,t.ename name,t.defect_level,t.project_dept address"
				+ ",'流向：' || t.flow || ' 缺陷等级：' || case t.defect_level when '1' then '低' when '2' then '中' when '3' then '高' when '4' then '严重' else '无缺陷' end || ' 管径：' || t.pipe_diameter tip"
				+ ",t.objectid,t.shape.minx x,t.shape.miny y, sde.st_astext(t.shape) wkt,t.S_DOMAINCAPTION" + " from ("
				+ sql + ")t where 1 = 1";
		searchSql += " and t.ROW_NO > " + startNum;
		// 查询
		try {
			List<RowBase> searchResultRows = DataUtil.getSelectRows(searchSql, parms);
			dataArray = JSONArray.fromObject(searchResultRows);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		// 计算分页
		request.calculatePaging();
		JSONObject json = toJson(request);
		resultJson.put("error", error);
		resultJson.put("paramInfo", paramInfo);
		resultJson.put("pageInfo", json);
		resultJson.put("data", dataArray);
		return resultJson.toString();
	}

	// 管网点
	public String getPipePoint(PipelinesPagingRequest request) {
		// 返回的结果
		JSONObject resultJson = new JSONObject();
		// 数据
		JSONArray dataArray = new JSONArray();
		JSONObject paramInfo = new JSONObject();
		// 报错信息
		String error = "";

		// 开始查询
		List<GlobalParameter> parms = new ArrayList<GlobalParameter>();
		String sql = "select t1.name,t1.photo,t2.OBJECTID,t1.exp_no,t2.shape,ROWNUM AS ROW_NO from BC_SITE_INFO t1,sde.monitor_station t2 where t1.exp_no=t2.exp_no";
		// 目前只支持一个点
		sql += " AND t1.EXP_NO = 'WS050400500268'";
		try {

			String filter = null;

			// // 管网类型
			// filter = request.getPipelinesType();
			// if (filter != null && !filter.isEmpty()) {
			// sql += " and t1.DEFECT_LEVEL = '" + filter + "'";
			// }
			//
			// // 行政区划
			// filter = request.getUnit();
			// if (filter != null && !filter.isEmpty()) {
			// sql += " and t5.S_DOMAINCAPTION like '%" + filter + "%'";
			// }
			//
			// // 街道
			// filter = request.getStreet();
			// if (filter != null && !filter.isEmpty()) {
			// sql += " and t5.S_DOMAINCAPTION like '%" + filter + "%'";
			// }

			// 搜索
			filter = request.getSearchText();
			if (filter != null && !filter.isEmpty()) {
				sql += " and ("

						+ "t1.name like '%" + filter + "%'"

						// + " or t.ENAME like '%" + filter + "%'"
						//
						// + " or t.LNO like '%" + filter + "%'"

						+ ")";
			}
		} catch (Exception e) {
		}

		int count = 0;
		// 统计总数
		try {
			count = getTotalCount(sql);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		request.setCount(count);

		// 开始查询
		// 增加分页条件--起始页和终点页
		int startNum = (request.getPageIndex() - 1) * request.getPageSize();
		int endNum = request.getPageIndex() * request.getPageSize();
		sql += " and ROWNUM <= " + endNum;

		String searchSql = "SELECT t.NAME,'深圳市龙岗区金牛东路茜坑路段' as ADDRESS,t.photo,t.shape.minx x,t.shape.miny y,t.OBJECTID,t.exp_no station_code,sde.st_astext(t.shape) wkt"
				+ " FROM (" + sql + ")t where 1 = 1";
		searchSql += " and t.ROW_NO > " + startNum;
		// 查询
		try {
			List<RowBase> searchResultRows = DataUtil.getSelectRows(searchSql, parms);
			dataArray = JSONArray.fromObject(searchResultRows);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		// 计算分页
		request.calculatePaging();
		JSONObject json = toJson(request);
		resultJson.put("error", error);
		resultJson.put("paramInfo", paramInfo);
		resultJson.put("pageInfo", json);
		resultJson.put("data", dataArray);
		return resultJson.toString();
	}

	// 清源小区
	public String getCommunityData(PipelinesPagingRequest request) {
		// 返回的结果
		JSONObject resultJson = new JSONObject();
		// 数据
		JSONArray dataArray = new JSONArray();
		JSONObject paramInfo = new JSONObject();
		// 报错信息
		String error = "";

		// 开始查询
		List<GlobalParameter> parms = new ArrayList<GlobalParameter>();
		String sql = " SELECT  t.小区名称 name, t.位置 address ,"
				+ " '小区编号：' || t.小区编号  || ' 小区类型：' || t.小区类型 || ' 状态：' || t.状态 tip," + "t.shape.minx x,"
				+ "t.shape.miny y, t.shape ,t.OBJECTID ,ROWNUM as ROW_NO "
				+ "FROM sde.building t where 1=1 and t.小区名称 IS NOT NULL";

		try {

			String filter = null;

			// 管网类型
			filter = request.getPipelinesType();
			if (filter != null && !filter.isEmpty()) {
				sql += " and t1.DEFECT_LEVEL = '" + filter + "'";
			}

			// 行政区划
			filter = request.getUnit();
			if (filter != null && !filter.isEmpty()) {
				sql += " and t.行政区划 like '%" + filter + "%'";
			}

			// 街道
			filter = request.getStreet();
			if (filter != null && !filter.isEmpty()) {
				sql += " and t.行政区划 like '%" + filter + "%'";
			}

			// 搜索
			filter = request.getSearchText();
			if (filter != null && !filter.isEmpty()) {
				sql += " and ("

						+ "t.OBJECTID like '%" + filter + "%'"

						+ " or t.小区名称 like '%" + filter + "%'"

						// + " or t.LNO like '%" + filter + "%'"

						+ ")";
			}
		} catch (Exception e) {
		}

		int count = 0;
		// 统计总数
		try {
			count = getTotalCount(sql);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		request.setCount(count);

		// 开始查询
		// 增加分页条件--起始页和终点页
		int startNum = (request.getPageIndex() - 1) * request.getPageSize();
		int endNum = request.getPageIndex() * request.getPageSize();
		sql += " and ROWNUM <= " + endNum;
		String searchSql = "SELECT name,address,tip,OBJECTID,x,y, sde.st_astext(t1.shape) wkt from (" + sql
				+ ")t1 where 1 = 1";
		searchSql += " and t1.ROW_NO > " + startNum;

		// 查询
		try {
			List<RowBase> searchResultRows = DataUtil.getSelectRows(searchSql, parms);
			dataArray = JSONArray.fromObject(searchResultRows);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}

		// 计算分页
		request.calculatePaging();
		JSONObject json = toJson(request);
		resultJson.put("error", error);
		resultJson.put("paramInfo", paramInfo);
		resultJson.put("pageInfo", json);
		resultJson.put("data", dataArray);
		return resultJson.toString();
	}

	// 排水管网
	public String getSewageData(PipelinesPagingRequest request) {
		// 返回的结果
		JSONObject resultJson = new JSONObject();
		// 数据
		JSONArray dataArray = new JSONArray();
		JSONObject paramInfo = new JSONObject();
		// 报错信息
		String error = "";

		// 开始查询
		List<GlobalParameter> parms = new ArrayList<GlobalParameter>();
		String sql = "select t.*,t1.img,t1.contact_address address_1,t1.ATTENTION_LEVEL ATTENTION_LEVEL_1,ROWNUM AS ROW_NO from sde.ps_wwtpm t,BC_ENTERPRISE_ATTR t1 WHERE t.EXP_NO = t1.EXP_NO";

		try {
			String filter = null;

			// 管网类型
			filter = request.getPipelinesType();
			if (filter != null && !filter.isEmpty()) {
				if ("国控".equals(filter)) {
					filter = "0";
				}else if ("省控".equals(filter)) {
					filter = "1";
				}else if ("市控".equals(filter)) {
					filter = "2";
				}else if ("其它".equals(filter)) {
					filter = "3";
				}
				sql += " and t1.ATTENTION_LEVEL = '" + filter + "'";
			}

			// 行政区划
			filter = request.getUnit();
			if (filter != null && !filter.isEmpty()) {
				sql += " and t1.contact_address like '%" + filter + "%'";
			}

			// 街道
			filter = request.getStreet();
			if (filter != null && !filter.isEmpty()) {
				sql += " and t1.contact_address like '%" + filter + "%'";
			}

			// 搜索
			filter = request.getSearchText();
			if (filter != null && !filter.isEmpty()) {
				sql += " and ("

						+ "t.OBJECTID like '%" + filter + "%'"

						+ " or t.NAME like '%" + filter + "%'"

						+ ")";
			}
		} catch (Exception e) {
		}

		int count = 0;
		// 统计总数
		try {
			count = getTotalCount(sql);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		request.setCount(count);

		// 开始查询
		// 增加分页条件--起始页和终点页
		int startNum = (request.getPageIndex() - 1) * request.getPageSize();
		int endNum = request.getPageIndex() * request.getPageSize();
		sql += " and ROWNUM <= " + endNum;

		String searchSql = " SELECT t.name ,t.exp_no,t.shape.minx x,t.shape.miny y,sde.st_astext(t.shape) wkt,t.address_1 address,t.img PHOTO,t.objectid,t.exp_no as wwtp_id,t.ATTENTION_LEVEL_1 ATTENTION_LEVEL FROM (" + sql + ")t where 1 = 1";
		searchSql += " and t.ROW_NO > " + startNum;
		// 查询
		try {
			List<RowBase> searchResultRows = DataUtil.getSelectRows(searchSql, parms);
			dataArray = JSONArray.fromObject(searchResultRows);
		} catch (Exception e) {
			error += e.getMessage() + "|";
		}
		// 计算分页
		request.calculatePaging();
		JSONObject json = toJson(request);
		resultJson.put("error", error);
		resultJson.put("paramInfo", paramInfo);
		resultJson.put("pageInfo", json);
		resultJson.put("data", dataArray);
		return resultJson.toString();
	}

	// 获取总数
	private int getTotalCount(String sql) throws Exception {
		List<GlobalParameter> parms = new ArrayList<GlobalParameter>();
		int count = 0;
		// 统计总数
		String totalSql = "SELECT COUNT(*) count from (" + sql + ")";
		List<RowBase> rows = DataUtil.getSelectRows(totalSql, parms);
		if (rows != null && rows.size() == 1) {
			RowBase rowBase = rows.get(0);
			count = rowBase.getSafeInt("COUNT");
		}
		return count;
	}

	private JSONObject toJson(PipelinesPagingRequest entity) {
		JSONObject json = new JSONObject();
		json.put("pageCount", entity.getPageCount());
		json.put("pageIndex", entity.getPageIndex());
		json.put("pageSize", entity.getPageSize());
		json.put("rowCount", entity.getCount());
		json.put("refreshRowCount", true);
		return json;
	}
}
